package com.example.springbootv1.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.Date;

public class LoginLog {
    private Long loginLogId;
    private String loginLogName;
    // 解决日期类型的相关问题
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date loginLogTime;

    private Double loginLogLevel;
    private String loginLogFlag;

    private Integer fromIndex;
    private Integer pageSize;

    public Integer getFromIndex() {
        return fromIndex;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public Integer getCurrentIndex() {
        return currentIndex;
    }

    public void setFromIndex(Integer fromIndex) {
        this.fromIndex = fromIndex;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public void setCurrentIndex(Integer currentIndex) {
        this.currentIndex = currentIndex;
    }

    private Integer currentIndex;
    public Long getLoginLogId() {
        return loginLogId;
    }

    public String getLoginLogName() {
        return loginLogName;
    }

    public Date getLoginLogTime() {
        return loginLogTime;
    }

    public Double getLoginLogLevel() {
        return loginLogLevel;
    }

    public String getLoginLogFlag() {
        return loginLogFlag;
    }

    public void setLoginLogId(Long loginLogId) {
        this.loginLogId = loginLogId;
    }

    public void setLoginLogName(String loginLogName) {
        this.loginLogName = loginLogName;
    }

    public void setLoginLogTime(Date loginLogTime) {
        this.loginLogTime = loginLogTime;
    }

    public void setLoginLogLevel(Double loginLogLevel) {
        this.loginLogLevel = loginLogLevel;
    }

    public void setLoginLogFlag(String loginLogFlag) {
        this.loginLogFlag = loginLogFlag;
    }

    @Override
    public String toString() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = null;
        if(loginLogTime != null) {
            time = sdf.format(loginLogTime);
        }

        return "LoginLog{" +
                "loginLogId=" + loginLogId +
                ", loginLogName='" + loginLogName + '\'' +
                ", loginLogTime=" + time +
                ", loginLogLevel=" + loginLogLevel +
                ", loginLogFlag='" + loginLogFlag + '\'' +
                '}';
    }
}
